home *** CD-ROM | disk | FTP | other *** search
/ TeX 1995 July / TeX CD-ROM July 1995 (Disc 1)(Walnut Creek)(1995).ISO / graphics / circuit_macros / README < prev   
Text File  |  1994-03-13  |  3KB  |  72 lines

  1. Circuit_macros version 1.0 (I suppose)
  2.  
  3. This is a set of macros for drawing circuits, operational amplifiers,
  4. and some block diagrams I have had occasion to require, for inclusion
  5. in [La]TeX documents printed with a postscript printer.  The advantages
  6. and disadvantages of such a system are those of TeX itself: ordinary
  7. character input, non-wysiwyg.  I use xfig for other kinds of diagrams
  8. but find a drawing language useful for graphics containing regularity
  9. such as do circuit diagrams.
  10.  
  11. Required software:  m4, gpic, tex, dvips
  12.  
  13. The base graphics language is pic, which is simple to use but
  14. limited in power.  On unix one can use gpic -t, but several years ago
  15. in the course of writing a book I took a few days off to write a pic
  16. interpreter that output latex picture objects, and which more recently
  17. has been changed to output pstricks objects, my personal preference
  18. because of the better quality of resulting graphics and greater
  19. control. I preferred the m4 macro processor to pic macros, and
  20. therefore m4 (a free version of which appeared recently) is required
  21. here.
  22.  
  23. Each diagram appears between .PS and .PE lines, with an optional
  24. dimension after .PS:
  25.  
  26. .PS 0.8
  27. source(up_ 0.5); llabel(-,v_s,+)
  28. {arrow right linewid/2; "$i_R$" at last arrow.end above}
  29. line right
  30. resistor(down_ 0.5); llabel(+,R,-)
  31. line left
  32. .PE
  33.  
  34. This file, bug.m4, say, is then processed as shown:
  35.  
  36.    m4 libcct.m4 gpic.m4 bug.m4 | gpic -t > bug.tex
  37.  
  38. where gpic.m4 is a file containing something like:
  39.  
  40.    undefine(`pstricks')define(`gpic',`defined')
  41.  
  42. The file bug.tex is then included in the LaTeX document in the usual way,
  43. and the .dvi file printed using dvips.
  44.  
  45. Installation:
  46.    Put the lib*.m4 files in your $HOME/lib directory.  Change the
  47. definition of HOMELIB_ in libcct.m4 and darrow.m4.
  48.  
  49. Examples:
  50.    Cd to the examples directory.  Change the definition of LIBCCT
  51. in Makefile.  Type `make'.
  52.  
  53. Manuals.  See any pic manual or the documentation that comes with gpic,
  54. which is part of the Gnu groff distribution.
  55.  
  56. Comments:  Pic has a very useful concept of the current point and current
  57. direction, the latter unfortunately limited to up, down, left, right.
  58. These macros need to know the current direction so down should be written
  59. as down_, etc.  The Point_ or rpoint_ macros set the current direction
  60. cosines x_, y_ which are used to draw complex objects in any orientation.
  61. Thus `Point(-30); resistor' draws a resistor along a line with slope -30
  62. degrees. `rpoint_(to Z)' sets the current direction cosines to point to Z.
  63. The default for all objects is `right_.'  The circuit element
  64. macros all may be invoked with arguments.  Thus `capacitor(from A to B)'
  65. draws a capacitor from A to B (of course).  The arguments may be any
  66. valid arguments following `line invis' in pic.  Real documentation
  67. will have to wait another day.  See the examples.  Inevitably a set of
  68. macros such as this will be modified to suit individual use and taste.
  69.  
  70. Dwight Aplevich
  71. aplevich@uwaterloo.ca
  72.